import { updateShinonePlugin } from "./update.js";
import { help } from "./help.js"
import {shinoneTest, toShinone, check, doChat, resetChat, clearChat, showChat, setMyKey, setModel} from "./shinone.js";
import fs from "fs";
import schedule from "node-schedule";

export {
  updateShinonePlugin,
  help,
  shinoneTest,
  toShinone,
  check,
  doChat,
  resetChat,
  clearChat,
  showChat,
  setMyKey,
  setModel
};

let rule = {
  // =================================================== 插件更新
  updateShinonePlugin: {
    reg: "^#*筱樱(强制)?更新$",
    priority: 5,
    describe: "更新筱樱插件",
  },
  help: {
    reg: "^#*筱樱帮助$",
    priority: 5,
    describe: "帮助文档，其实是图片"
  },
  toShinone: {
    reg: ".*",
    priority: 5,
    describe: "联系筱音的办法就是带上他的名字"
  },
  doChat: {
    reg: "^#筱樱 .*",
    priority: 5,
    describe: "和筱樱对话"
  },
  resetChat: {
    reg: "^#*筱樱重置$",
    priority: 5,
    describe: "重置对话"
  },
  clearChat: {
    reg: "^#*筱樱清除$",
    priority: 5,
    describe: "清除最后一条对话"
  },
  showChat: {
    reg: "^#*筱樱对话状态$",
    priority: 5,
    describe: "查看对话状态"
},
  setMyKey: {
    reg: "^#*筱樱设置key",
    priority: 5,
    describe: "设置key"
  },
  setModel: {
    reg: "^#*筱樱设置模型",
    priority: 5,
    describe: "设置模型"
  }
};

// 定时任务
async function task() {
  let scheduleConfig1 = "0 0 9 * * ?"; // 默认
  let scheduleConfig2 = "0 30 13 * * ?"; // 默认
  let scheduleConfig3 = "0 30 17 * * ?"; // 默认
  let scheduleConfig4 = "0 00 20 * * ?"; // 默认
  schedule.scheduleJob(scheduleConfig1, () => check());
  schedule.scheduleJob(scheduleConfig2, () => check());
  schedule.scheduleJob(scheduleConfig3, () => check());
  schedule.scheduleJob(scheduleConfig4, () => check());
}

// task();

export { rule };
